local sk__xiuluo = fk.CreateSkill {

  name = "sk__xiuluo",

  tags = {  },

}



sk__xiuluo:addEffect(fk.TargetConfirmed, {
  name = "sk__xiuluo",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__xiuluo.name) and (data.card.trueName == "slash" or data.card:isCommonTrick()) and
      data.card.name ~= "duel" and #data:getAllTargets() == 1
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player, sk__xiuluo.name, nil, "#sk__xiuluo-invoke:::"..data.card:toLogString())
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, sk__xiuluo.name)
    room:sendLog{
      type = "#SkChangeCardSkill",
      from = player.id,
      to = { data.from.id },
      arg = sk__xiuluo.name,
      arg2 = data.card:toLogString(),
      arg3 = "savage_assault",
    }
    local use = room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true)
    if use ~= nil then
      local new_card = Fk:cloneCard("duel", data.card.suit, data.card.number)
      local c = table.simpleClone(data.card)
      for k, v in pairs(c) do
        if new_card[k] == nil then
          new_card[k] = v
        end
      end
      if data.card:isVirtual() then
        new_card.subcards = data.card.subcards
      else
        new_card.id = data.card.id
      end
      new_card.skillNames = data.card.skillNames
      new_card.skill = Fk.skills["duel_skill"]
      data.card = new_card
      use.data.card = new_card
    end
  end,
})

return sk__xiuluo